package com.hksj.Intelligentmanagement.controller;


import com.hksj.Intelligentmanagement.common.Result;
import com.hksj.Intelligentmanagement.dto.DicTypeDTO;
import com.hksj.Intelligentmanagement.service.DicTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "字典类型管理")
@RestController
@RequestMapping("/api/dicType")
public class DicTypeController {

    @Autowired
    private DicTypeService dicTypeService;

    @ApiOperation(value = "新增字典类型")
    @PostMapping("/addDicType")
    public Result addDicType(@RequestBody DicTypeDTO dicTypeDTO) {
        return dicTypeService.addDicType(dicTypeDTO);
    }

    @ApiOperation(value = "删除字典类型")
    @DeleteMapping("/deleteDicType/{id}")
    public Result deleteDicType(@PathVariable("id") String id) {
        return dicTypeService.deleteDicType(id);
    }

    @ApiOperation(value = "更新字典类型")
    @PutMapping("/updateDicType")
    public Result updateDicType(@RequestBody DicTypeDTO dicTypeDTO) {
        return dicTypeService.updateDicType(dicTypeDTO);
    }

    @ApiOperation(value = "根据id查询单个字典类型")
    @GetMapping("/queryDicTypeById/{id}")
    public Result queryDicTypeById(@PathVariable("id") String id) {
        return dicTypeService.queryDicTypeById(id);
    }

    @ApiOperation(value = "查询字典类型列表")
    @PostMapping("/queryDicTypeList")
    @ResponseBody
    public Result queryDicTypeList() {
        return Result.data(dicTypeService.queryDicTypeList());
    }

}
